<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::post('sendCode', 'api\Register@sendCode');

Route::get('getSwiper', 'api\Swiper@getSwiper');

Route::get('getCategory', 'api\Category@getCategory');

Route::get('getIndexCourse', 'api\Course@getIndexCourse');

Route::get('getCourseDetail', 'api\Course@getCourseDetail');

Route::get('getSpeCourse', 'api\Course@getSpeCourse');

Route::get('getCatCourse', 'api\Course@getCatCourse');

/*
Route::get($uri, $callback);      //处理get请求
Route::post($uri, $callback);     //处理post请求
Route::put($uri, $callback);     
Route::patch($uri, $callback);
Route::delete($uri, $callback);
Route::options($uri, $callback);
*/

Route::redirect('/here', '/there', '301'); // 重定向路由
//访问http://blog.laravel8.cn/here 时，直接跳转到 http://blog.laravel8.cn/there了

// 视图路由
Route::view('/welcome', 'welcome', ['username' => '暮云归']);

Route::match(['get', 'post'], 'foo', function () {
    return 'This is a request from get or post';
});
    
Route::any('bar', function () {
    return 'This is a request from any HTTP verb';
});
